package com.yuzhi.system.domain;

import com.fasterxml.jackson.annotation.JsonAlias;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.util.List;

/**
 * @Author Mario
 */
@Data
@Accessors(chain = true)
@EqualsAndHashCode(onlyExplicitlyIncluded = true)
public class AreaShort implements Serializable {

    @EqualsAndHashCode.Include
    @JsonAlias("id")
    private String code;
    private String name;
    @JsonAlias("deep")
    private int level;
    @JsonAlias("ext_name")
    private String extName;
    @JsonAlias("short_name")
    private String shortName;
    @JsonAlias("childs")
    private List<AreaShort> children;
    public boolean isProvince() {
        return level == 0;
    }
    public boolean isCity() {
        return level == 1;
    }

}
